Home:ALL Converter>Angular PDFMake Dynamic Table with Nested JSON

Angular PDFMake Dynamic Table with Nested JSON

Ask Time:2021-11-26T00:58:17         Author:Dabrownie

Json Formatter

I have used a code I found on here Building table dynamically with PDFMake it works perfectly fine with dynamic data coming from an API. But my problem is Nested JSON.

This is how the JSON looks like:

dataseries":[
      {
         "timepoint":3,
         "cloudcover":2,
         "seeing":6,
         "transparency":2,
         "lifted_index":10,
         "rh2m":2,
         "wind10m":{
            "direction":"N",
            "speed":2
         },
         "temp2m":23,
         "prec_type":"none"
      },
      {
         "timepoint":6,
         "cloudcover":2,
         "seeing":6,
         "transparency":2,
         "lifted_index":15,
         "rh2m":3,
         "wind10m":{
            "direction":"N",
            "speed":2
         },
         "temp2m":21,
         "prec_type":"none"
      },

I am trying to generate the content of wind10m specifically the direction and speed on the PDF file. How do I access and generate two different columns of direction and speed?

This is my stackblitz demo:https://stackblitz.com/edit/angular-ojgxtj?file=src%2Fapp%2Fapp.component.ts

Author:Dabrownie,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/70114856/angular-pdfmake-dynamic-table-with-nested-json
yy